#pragma once

#include "SDL.h"
#include <Windows.h>

class SDLInput
{
public:
	static SDLInput* GetInstance()
	{
		if(instance == NULL)
		{
			instance = new SDLInput();
		}
		return instance;
	}

	static void Kill()
	{
		if(instance != NULL)
		{
			delete instance;
			instance = NULL;
		}
	}

	// Methods
	void Poll();
	bool KeyDown(int i);
	bool MouseButtonDown(int i);

	// Getters / Setters
	char Key(int i) const			{return key[i];}
	int MouseX() const				{return mouseX;}
	int MouseY() const				{return mouseY;}
	int MouseXrel()	const			{return mouseXRel;}
	int MouseYrel() const			{return mouseYRel;}
	int MouseButton(int i) const	{return mouseButtons[i];}
	int HasQuit() const				{return quit;}

private:
	static SDLInput* instance;

	static const int MOUSE_BTN_MAX = 8;

	char key[SDLK_LAST];
	char lastKey[SDLK_LAST];
	char mouseButtons[MOUSE_BTN_MAX];
	char lastMouseButtons[MOUSE_BTN_MAX];

	int mouseX,mouseY;
	int mouseXRel,mouseYRel;
	char quit;

	SDLInput();
	~SDLInput();
};

